package net.entelijan.cobean.examples.showcase.bind.text;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;

import net.entelijan.cobean.examples.util.ExamplesUtil;
import net.entelijan.scf.DefaultShowcasePanel;
import net.miginfocom.swing.MigLayout;

public class PathBindPanel extends DefaultShowcasePanel {

	private static final long serialVersionUID = 1L;

	private JTextField failureTextField = createFailureTextField();

	private JTextField authorNameTextField = new JTextField();

	private JTextField authorBirthdayTextField = new JTextField();

	private JTextField authorIdTextField = new JTextField();

	private JTextField bookTitleTextField = new JTextField();

	private JTextField bookIDTextField = new JTextField();

	private JTextField bookSubtitleTextField = new JTextField();

	private JTextField bookYearTextField = new JTextField();

	private JButton showBooksButton = new JButton("Show Books");

	private JButton nextBookButton = new JButton("Books >>");

	private JButton previousBookButton = new JButton("<< Books");

	private JButton setDummyAuthorButton = new JButton("Set Dummy Author");

	public PathBindPanel() {
		super();
		setLayout(new MigLayout());
		add(new JLabel(""), "w 100:100:max");
		add(new JLabel(""), "");
		add(failureTextField, "w max, wrap");
		add(new JSeparator(), "span 3, grow, wrap");

		add(new JLabel("Book"), "");
		add(new JLabel("Title:"), "");
		add(bookTitleTextField, "w max, wrap");
		add(new JLabel(""), "");
		add(new JLabel("Subtitle:"), "");
		add(bookSubtitleTextField, "w max, wrap");
		add(new JLabel(""), "");
		add(new JLabel("Year of Publication:"), "");
		add(bookYearTextField, "w max, wrap");
		add(new JLabel(""), "");
		add(new JLabel("ID:"), "");
		add(bookIDTextField, "w max, wrap");
		add(new JSeparator(), "span 3, grow, wrap");

		add(new JLabel("Author"), "");
		add(new JLabel("Name:"), "w 100:100:max");
		add(authorNameTextField, "w max, wrap");
		add(new JLabel(""), "");
		add(new JLabel("Birthday:"), "");
		add(authorBirthdayTextField, "w max, wrap");
		add(new JLabel(""), "");
		add(new JLabel("ID:"), "");
		add(authorIdTextField, "w max, wrap");
		add(new JSeparator(), "span 3, grow, wrap");

		add(new JPanel(), "w max, span 3, h max, grow, wrap");
		add(ExamplesUtil.createButtonsPanel(150, this.showBooksButton,
				this.previousBookButton, this.nextBookButton,
				this.setDummyAuthorButton), "span 3");
	}

	private JTextField createFailureTextField() {
		JTextField re = new JTextField();
		re.setFocusable(false);
		re.setEditable(false);
		return re;
	}

	public JTextField getBookTitleTextField() {
		return bookTitleTextField;
	}

	public void setBookTitleTextField(JTextField bookTitleTextField) {
		this.bookTitleTextField = bookTitleTextField;
	}

	public JTextField getAuthorNameTextField() {
		return authorNameTextField;
	}

	public void setAuthorNameTextField(JTextField authorNameTextField) {
		this.authorNameTextField = authorNameTextField;
	}

	public JTextField getAuthorBirthdayTextField() {
		return authorBirthdayTextField;
	}

	public void setAuthorBirthdayTextField(JTextField authorBirthdayTextField) {
		this.authorBirthdayTextField = authorBirthdayTextField;
	}

	public JTextField getAuthorIdTextField() {
		return authorIdTextField;
	}

	public void setAuthorIdTextField(JTextField authorIdTextFiels) {
		this.authorIdTextField = authorIdTextFiels;
	}

	public JTextField getFailureTextField() {
		return failureTextField;
	}

	public void setFailureTextField(JTextField failureTextField) {
		this.failureTextField = failureTextField;
	}

	public JButton getShowBooksButton() {
		return showBooksButton;
	}

	public void setShowBooksButton(JButton showBookButton) {
		this.showBooksButton = showBookButton;
	}

	public JButton getNextBookButton() {
		return nextBookButton;
	}

	public void setNextBookButton(JButton nextBookButton) {
		this.nextBookButton = nextBookButton;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public JTextField getBookIDTextField() {
		return bookIDTextField;
	}

	public void setBookIDTextField(JTextField bookIDTextField) {
		this.bookIDTextField = bookIDTextField;
	}

	public JTextField getBookSubtitleTextField() {
		return bookSubtitleTextField;
	}

	public void setBookSubtitleTextField(JTextField bookSubtitleTextField) {
		this.bookSubtitleTextField = bookSubtitleTextField;
	}

	public JTextField getBookYearTextField() {
		return bookYearTextField;
	}

	public void setBookYearTextField(JTextField bookYearTextField) {
		this.bookYearTextField = bookYearTextField;
	}

	public JButton getPreviousBookButton() {
		return previousBookButton;
	}

	public void setPreviousBookButton(JButton previousBookButton) {
		this.previousBookButton = previousBookButton;
	}

	public JButton getSetDummyAuthorButton() {
		return setDummyAuthorButton;
	}

	public void setSetDummyAuthorButton(JButton setDummyAuthorButton) {
		this.setDummyAuthorButton = setDummyAuthorButton;
	}

}
